<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CompanyTransferOrderDetail extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('company_transfer_order_detail', ['engine' => 'InnoDB', 'comment' => '公司调拨单详情表']);
        $table->addColumn('t_oid', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '公司调拨单id'])
              ->addColumn('dealer_goods_id', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '商品id'])
              ->addColumn('dealer_goods_spec_id', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '商品规格id'])
              ->addColumn('transfer_num', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '调拨数量'])
              ->addColumn('create_time', 'integer', ['limit' => 10, 'default' => null, 'comment' => '创建时间'])
              ->addColumn('update_time', 'integer', ['limit' => 10, 'default' => null, 'comment' => '更新时间'])
              ->addColumn('delete_time', 'integer', ['limit' => 10, 'default' => null, 'comment' => '删除时间'])
              ->addIndex('t_oid', ['name' => 'idx_t_oid'])
              ->addIndex('dealer_goods_id', ['name' => 'idx_dealer_goods_id'])
              ->addIndex('dealer_goods_spec_id', ['name' => 'idx_dealer_goods_spec_id'])
              ->create();
    }
}
